
from django.conf.urls.defaults import *
from django.views.generic.simple import redirect_to

urlpatterns = patterns('memebase.views',
    url('^$', 'sites.main', name='main'),
    url('^clean/$', 'sites.clean_root'),
    url('^sites/$', redirect_to, {'url' : 'view/'}),
    url('^sites/create/$', 'sites.create_site', name='create_new_site'),
    url('^sites/view/$', 'sites.list_sites', name='list_existing_sites'),
    url('^sites/view/(?P<sitename>[0-9a-zA-Z-_]*)/$', 'sites.view_site', name='sites_root'),
    url('^sites/view/(?P<sitename>[0-9a-zA-Z-_]*)/memes/$', redirect_to, {'url' : 'view/'}),
    url('^sites/view/(?P<sitename>[0-9a-zA-Z-_]*)/memes/create/$', 'memes.create_meme', name='create_new_meme'),
    url('^sites/view/(?P<sitename>[0-9a-zA-Z-_]*)/memes/view/$', 'memes.list_memes', name='list_existing_memes'),
    url('^sites/view/(?P<sitename>[0-9a-zA-Z-_]*)/memes/view/(?P<memename>[0-9]*)/$', 'memes.view_meme', name='view_meme'),
    url('^sites/view/(?P<sitename>[0-9a-zA-Z-_]*)/memes/edit/(?P<memename>[0-9]*)/$', 'memes.edit_meme', name='edit_meme'),
    url('^sites/view/(?P<sitename>[0-9a-zA-Z-_]*)/memes/edit/(?P<memename>[0-9]*)/cmd/$', 'memes.edit_meme_cmd', name='edit_meme_cmd'),
    url('^sites/view/(?P<sitename>[0-9a-zA-Z-_]*)/memes/edit/(?P<memename>[0-9]*)/save/$', 'memes.edit_meme_save', name='save_meme'),

)
